package com.study.javaFx.model;

import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class MachineType {

    private final IntegerProperty typeId;
    private final StringProperty typeName;
    private final StringProperty specifications;
    private final DoubleProperty hourlyRate;

    public MachineType(Integer typeId, String typeName, String specifications, double hourlyRate) {
        this.typeId = new SimpleIntegerProperty(typeId);
        this.typeName = new SimpleStringProperty(typeName);
        this.specifications = new SimpleStringProperty(specifications);
        this.hourlyRate = new SimpleDoubleProperty(hourlyRate);
    }

    public MachineType() {
        this.typeId = new SimpleIntegerProperty(0);
        this.typeName = new SimpleStringProperty("");
        this.specifications = new SimpleStringProperty("");
        this.hourlyRate = new SimpleDoubleProperty(0.0);
    }

    // --- Getters and Property Getters ---

    @JsonProperty("typeId")
    public int getTypeId() {
        return typeId.get();
    }

    @JsonProperty("typeId")
    public void setTypeId(int id) {
        this.typeId.set(id);
    }

    public IntegerProperty typeIdProperty() {
        return typeId;
    }

    @JsonProperty("typeName")
    public String getTypeName() {
        return typeName.get();
    }

    @JsonProperty("typeName")
    public void setTypeName(String s) {
        this.typeName.set(s);
    }

    public StringProperty typeNameProperty() {
        return typeName;
    }

    @JsonProperty("specifications")
    public String getSpecifications() {
        return specifications.get();
    }

    @JsonProperty("specifications")
    public void setSpecifications(String s) {
        this.specifications.set(s);
    }

    public StringProperty specificationsProperty() {
        return specifications;
    }

    @JsonProperty("hourlyRate")
    public double getHourlyRate() {
        return hourlyRate.get();
    }

    @JsonProperty("hourlyRate")
    public void setHourlyRate(double r) {
        this.hourlyRate.set(r);
    }

    public DoubleProperty hourlyRateProperty() {
        return hourlyRate;
    }
} 